﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace WoSai.Base.Config
{
    public class DefaultConfig
    {
        private static System.Timers.Timer defaultConfigTimer = new System.Timers.Timer(15000);
        private static DefaultConfigInfo configInfo;
        static DefaultConfig()
        {
            configInfo = DefaultConfigFileManager.LoadCachedConfig();
            defaultConfigTimer.AutoReset = true;
            defaultConfigTimer.Enabled = true;
            defaultConfigTimer.Elapsed += new System.Timers.ElapsedEventHandler(defaultConfigTimer_Elapsed);
            defaultConfigTimer.Start();
         }
        static void defaultConfigTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
        {
            ResetConfig();
        }
        public static void ResetConfig()
        {
            configInfo = DefaultConfigFileManager.LoadFileConfig();
        }
        public static string DBconnectionstring
        {
            get
            {
                return configInfo.DbConnectionString;
            }
        }
    }
}
